﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace SHomeWorkshop.LunarPresentation.Widegets
{
    /// <summary>
    /// RowOperationsControl.xaml 的交互逻辑
    /// </summary>
    public partial class RowOperationsControl : UserControl
    {
        public RowOperationsControl()
        {
            InitializeComponent();
        }

        public event EventHandler<RowOperationButtonClickedEventArgs> CmdButtonClicked;

        protected void OnCmdButtonClicked(object sender, RowOperationButtonClickedEventArgs e)
        {
            if (CmdButtonClicked != null)
            {
                CmdButtonClicked(sender, e);
            }
        }

        private void btnLeftSideMoveLeft_Click(object sender, RoutedEventArgs e)
        {
            OnCmdButtonClicked(this, new RowOperationButtonClickedEventArgs(RowOperationCommand.LeftSideMoveLeft));
        }

        private void btnLeftSideMoveRight_Click(object sender, RoutedEventArgs e)
        {
            OnCmdButtonClicked(this, new RowOperationButtonClickedEventArgs(RowOperationCommand.LeftSideMoveRight));
        }

        private void btnTopSideMoveUp_Click(object sender, RoutedEventArgs e)
        {
            OnCmdButtonClicked(this, new RowOperationButtonClickedEventArgs(RowOperationCommand.TopSideMoveUp));
        }

        private void btnTopSideMoveDown_Click(object sender, RoutedEventArgs e)
        {
            OnCmdButtonClicked(this, new RowOperationButtonClickedEventArgs(RowOperationCommand.TopSideMoveDown));
        }

        private void btnRightSideMoveRight_Click(object sender, RoutedEventArgs e)
        {
            OnCmdButtonClicked(this, new RowOperationButtonClickedEventArgs(RowOperationCommand.RightSideMoveRight));
        }

        private void btnRightSideMoveLeft_Click(object sender, RoutedEventArgs e)
        {
            OnCmdButtonClicked(this, new RowOperationButtonClickedEventArgs(RowOperationCommand.RightSideMoveLeft));
        }

        private void btnBottomSideMoveDown_Click(object sender, RoutedEventArgs e)
        {
            OnCmdButtonClicked(this, new RowOperationButtonClickedEventArgs(RowOperationCommand.BottomSideMoveDown));
        }

        private void btnBottomSideMoveUp_Click(object sender, RoutedEventArgs e)
        {
            OnCmdButtonClicked(this, new RowOperationButtonClickedEventArgs(RowOperationCommand.BottomSideMoveUp));
        }

        private void btnSplitSubExsToParentPanelOfRow_Click(object sender, RoutedEventArgs e)
        {
            OnCmdButtonClicked(this, new RowOperationButtonClickedEventArgs(RowOperationCommand.SplitSubExsToParentPanelOfRow));
        }
    }

    public class RowOperationButtonClickedEventArgs : EventArgs
    {
        public RowOperationButtonClickedEventArgs(RowOperationCommand cmd)
        {
            this.cmd = cmd;
        }

        private RowOperationCommand cmd;

        public RowOperationCommand Cmd
        {
            get { return cmd; }
        }
    }

    public enum RowOperationCommand
    {
        LeftSideMoveLeft, LeftSideMoveRight,
        TopSideMoveUp, TopSideMoveDown,
        RightSideMoveLeft, RightSideMoveRight,
        BottomSideMoveUp, BottomSideMoveDown,
        SplitSubExsToParentPanelOfRow
    }
}
